package com.arpa.wms.domain.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Digits;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;

/**
 * 领用单明细
 * @author jinss
 * @date 2020-08-20 11:01:32
 **/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="CollectItem对象", description="领用单明细")
@TableName("wms_collect_item")
public class CollectItem extends BasicEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "数据标识")
    @TableField("code")
    private String code;

    @ApiModelProperty(value = "所属机构")
    @TableField("group_code")
    private String groupCode;

    @ApiModelProperty(value = "领用单号")
    @TableField("collect_code")
    private String collectCode;

    @ApiModelProperty(value = "商品code")
    @TableField("goods_code")
    @NotBlank(message = "领用明细商品不能为空", groups = {Collect.Save.class, Collect.Update.class})
    private String goodsCode;

    @ApiModelProperty(value = "商品名称")
    @TableField("goods_name")
    @NotBlank(message = "领用明细商品名称不能为空", groups = {Collect.Save.class, Collect.Update.class})
    private String goodsName;

    @ApiModelProperty(value = "商品条码")
    @TableField("goods_bar_code")
    @NotBlank(message = "领用明细商品条码不能为空", groups = {Collect.Save.class, Collect.Update.class})
    private String goodsBarCode;

    @ApiModelProperty(value = "商品规格")
    @TableField("spec")
    private String spec;

    @ApiModelProperty(value = "单位")
    @TableField("goods_unit")
    @NotBlank(message = "领用明细单位不能为空", groups = {Collect.Save.class, Collect.Update.class})
    private String goodsUnit;

    @ApiModelProperty(value = "单位")
    @TableField("goods_unit_name")
    private String goodsUnitName;

    @ApiModelProperty(value = "基本单位领用数量")
    @TableField("quantity")
    private BigDecimal quantity;

    @ApiModelProperty(value = "基本单位实际领用数量")
    @TableField("actual_quantity")
    private BigDecimal actualQuantity;

    @ApiModelProperty(value = "单位领用数量")
    @TableField("unit_quantity")
    @Min(value = 1, message = "领用单明细单位领用数量不能小于等于0", groups = {Collect.Save.class, Collect.Update.class})
    @Digits(integer = 20, fraction = 6, message = "领用单明细单位领用数量的值超出了允许范围(只允许在20位整数和6位小数范围内)", groups = {Collect.Save.class, Collect.Update.class})
    private BigDecimal unitQuantity;

    @ApiModelProperty(value = "单位实际领用数量")
    @TableField("actual_unit_quantity")
    private BigDecimal actualUnitQuantity;

    @ApiModelProperty(value = "备注")
    @TableField("remarks")
    @Length(max = 255, message = "领用单明细备注长度不能大于255个字符", groups = {Collect.Save.class, Collect.Update.class})
    private String remarks;

    @ApiModelProperty(value = "基本单位")
    @TableField("basic_unit")
    @NotBlank(message = "领用明细基本单位不能为空", groups = {Collect.Save.class, Collect.Update.class})
    private String basicUnit;

    @ApiModelProperty(value = "基本单位名称")
    @TableField("basic_unit_name")
    private String basicUnitName;

    @ApiModelProperty(value = "基本单位转换数量")
    @TableField("basic_quantity")
//    @NotBlank(message = "领用明细基本单位转换数量不能为空", groups = {Collect.Save.class, Collect.Update.class})
    private BigDecimal basicQuantity;

    @ApiModelProperty(value = "商品编码")
    @TableField("good_code")
    @NotBlank(message = "领用明细商品编码不能为空", groups = {Collect.Save.class, Collect.Update.class})
    private String goodCode;


}
